//
//  ACLiveIntroductionViewController.m
//  ACLiteAVUISDK
//
//  Created by 冯琰琰 on 2021/3/30.
//

#import "ACLiveIntroductionViewController.h"

@interface ACLiveIntroductionViewController ()
@property (unsafe_unretained, nonatomic) IBOutlet UIImageView *liverIcon;
@property (unsafe_unretained, nonatomic) IBOutlet UILabel *liverName;
@property (unsafe_unretained, nonatomic) IBOutlet UILabel *liveTitle;
@property (unsafe_unretained, nonatomic) IBOutlet UILabel *liveTime;
@property (unsafe_unretained, nonatomic) IBOutlet UILabel *liveContentTitle;
@property (unsafe_unretained, nonatomic) IBOutlet UIImageView *liveContentImage;
@property (unsafe_unretained, nonatomic) IBOutlet UILabel *liveContent;

@end

@implementation ACLiveIntroductionViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = UIColorFromRGB(0xffffff);
    self.liverIcon.layer.masksToBounds = YES;
    self.liverIcon.layer.cornerRadius = 20;
}

-(void)setLiveModel:(ACLiveModel *)liveModel{
    _liveModel = liveModel;
    ACLiveCreaterModel *creater = _liveModel.user;
    self.liverName.text = creater.nickname;
    NSString *headIconStr = creater.avatar;
    if ((![headIconStr startsWith:@"http://"] && ![headIconStr startsWith:@"https://"]) && headIconStr != nil) {
        headIconStr = [@"http://" stringByAppendingString:headIconStr];
    }
    [self.liverIcon sd_setImageWithURL:[NSURL URLWithString:headIconStr]];
    self.liveTitle.text = [@"路演主题：" stringByAppendingString:_liveModel.title];
    self.liveTime.text = [@"开始时间：" stringByAppendingString:_liveModel.start_time];
    self.liveContentTitle.text = _liveModel.intro_title;
    NSString *intro_imgStr = _liveModel.intro_img;
    if ((![ intro_imgStr startsWith:@"http://"] && ![intro_imgStr startsWith:@"https://"]) && intro_imgStr!= nil) {
        intro_imgStr = [@"http://" stringByAppendingString: intro_imgStr];
    }
    [self.liveContentImage sd_setImageWithURL:[NSURL URLWithString:intro_imgStr]];
    self.liveContent.text = _liveModel.intro_desc;
    
}
#pragma mark - JXCategoryListContentViewDelegate

/**
 实现 <JXCategoryListContentViewDelegate> 协议方法，返回该视图控制器所拥有的「视图」
 */
- (UIView *)listView {
    return self.view;
}

@end
